package com.jeesite.modules.task.deploy.service;

import java.util.*;

import com.jeesite.modules.task.feedback.entity.DcSupTaskFeedback;
import com.jeesite.modules.task.feedback.service.DcSupTaskFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.task.deploy.entity.DcSupTaskInfoAdd;
import com.jeesite.modules.task.deploy.dao.DcSupTaskInfoAddDao;

/**
 * 任务部署信息表-记录预期反馈时间Service
 * @author zrr
 * @version 2022-03-03
 */
@Service
@Transactional(readOnly=false)
public class DcSupTaskInfoAddService extends CrudService<DcSupTaskInfoAddDao, DcSupTaskInfoAdd> {

	@Autowired
	
	private DcSupTaskInfoAddDao dcSupTaskInfoAddDao;
	@Autowired
	private DcSupTaskFeedbackService dcSupTaskFeedbackService;
	/**
	 * 获取单条数据
	 * @param dcSupTaskInfoAdd
	 * @return
	 */
	@Override
	public DcSupTaskInfoAdd get(DcSupTaskInfoAdd dcSupTaskInfoAdd) {
		return super.get(dcSupTaskInfoAdd);
	}
	
	/**
	 * 查询分页数据
	 * @param dcSupTaskInfoAdd 查询条件
	 * @param dcSupTaskInfoAdd.page 分页对象
	 * @return
	 */
	@Override
	public Page<DcSupTaskInfoAdd> findPage(DcSupTaskInfoAdd dcSupTaskInfoAdd) {
		return super.findPage(dcSupTaskInfoAdd);
	}
	
	/**
	 * 查询列表数据
	 * @param dcSupTaskInfoAdd
	 * @return
	 */
	@Override
	public List<DcSupTaskInfoAdd> findList(DcSupTaskInfoAdd dcSupTaskInfoAdd) {
		return super.findList(dcSupTaskInfoAdd);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param dcSupTaskInfoAdd
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(DcSupTaskInfoAdd dcSupTaskInfoAdd) {
		super.save(dcSupTaskInfoAdd);
	}
	
	/**
	 * 更新状态
	 * @param dcSupTaskInfoAdd
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(DcSupTaskInfoAdd dcSupTaskInfoAdd) {
		super.updateStatus(dcSupTaskInfoAdd);
	}
	
	/**
	 * 删除数据
	 * @param dcSupTaskInfoAdd
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(DcSupTaskInfoAdd dcSupTaskInfoAdd) {
		super.delete(dcSupTaskInfoAdd);
	}

	/**
	 * 查询选择器
	 * @param taskId
	 * @param actionId
	 * @return
	 */
	public List<Map<String,String>> getSelectList(String taskId,String actionId){
		List<Map<String, String>> selectList = dcSupTaskInfoAddDao.getSelectList(taskId);
		DcSupTaskFeedback dcSupTaskFeedback = new DcSupTaskFeedback();
		dcSupTaskFeedback.setActionId(actionId);
		//查询feedback_status!=1
		dcSupTaskFeedback.setRemarks2("1");
		List<Map<String, String>> listOverRideStr = dcSupTaskFeedbackService.findListOverRideStr(dcSupTaskFeedback);
		selectList.removeAll(listOverRideStr);
		return selectList;
	}

	public Date getSTimeByEtime(String formatDate, String taskId) {
		return dcSupTaskInfoAddDao.getSTimeByEtime(formatDate,taskId);
	}

    public void saveRefine(DcSupTaskInfoAdd dcSupTaskInfoAdd) {
		dao.saveRefine(dcSupTaskInfoAdd);
    }

	public void updateRefineTime(DcSupTaskInfoAdd dcSupTaskInfoAdd) {
		dao.updateRefineTime(dcSupTaskInfoAdd);
	}
}